'\" t
.TH "SYSTEMD\-CRYPTENROLL" "1" "" "systemd 249" "systemd-cryptenroll"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
systemd-cryptenroll \- Enroll PKCS#11, FIDO2, TPM2 token/devices to LUKS2 encrypted volumes
.SH "SYNOPSIS"
.HP \w'\fBsystemd\-cryptenroll\ \fR\fB[OPTIONS...]\fR\fB\ \fR\fB[DEVICE]\fR\ 'u
\fBsystemd\-cryptenroll \fR\fB[OPTIONS...]\fR\fB \fR\fB[DEVICE]\fR
.SH "DESCRIPTION"
.PP
\fBsystemd\-cryptenroll\fR
is a tool for enrolling hardware security tokens and devices into a LUKS2 encrypted volume, which may then be used to unlock the volume during boot\&. Specifically, it supports tokens and credentials of the following kind to be enrolled:
.sp
.RS 4
.ie n \{\
\h'-04' 1.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  1." 4.2
.\}
PKCS#11 security tokens and smartcards that may carry an RSA key pair (e\&.g\&. various YubiKeys)
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 2.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  2." 4.2
.\}
FIDO2 security tokens that implement the
"hmac\-secret"
extension (most FIDO2 keys, including YubiKeys)
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 3.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  3." 4.2
.\}
TPM2 security devices
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 4.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  4." 4.2
.\}
Recovery keys\&. These are similar to regular passphrases, however are randomly generated on the computer and thus generally have higher entropy than user chosen passphrases\&. Their character set has been designed to ensure they are easy to type in, while having high entropy\&. They may also be scanned off screen using QR codes\&. Recovery keys may be used for unlocking LUKS2 volumes wherever passphrases are accepted\&. They are intended to be used in combination with an enrolled hardware security token, as a recovery option when the token is lost\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04' 5.\h'+01'\c
.\}
.el \{\
.sp -1
.IP "  5." 4.2
.\}
Regular passphrases
.RE
.PP
In addition, the tool may be used to enumerate currently enrolled security tokens and wipe a subset of them\&. The latter may be combined with the enrollment operation of a new security token, in order to update or replace enrollments\&.
.PP
The tool supports only LUKS2 volumes, as it stores token meta\-information in the LUKS2 JSON token area, which is not available in other encryption formats\&.
.SH "OPTIONS"
.PP
The following options are understood:
.PP
\fB\-\-password\fR
.RS 4
Enroll a regular password/passphrase\&. This command is mostly equivalent to
\fBcryptsetup luksAddKey\fR, however may be combined with
\fB\-\-wipe\-slot=\fR
in one call, see below\&.
.RE
.PP
\fB\-\-recovery\-key\fR
.RS 4
Enroll a recovery key\&. Recovery keys are most identical to passphrases, but are computer generated instead of human chosen, and thus have a guaranteed high entropy\&. The key uses a character set that is easy to type in, and may be scanned off screen via a QR code\&.
.RE
.PP
\fB\-\-pkcs11\-token\-uri=\fR\fIURI\fR
.RS 4
Enroll a PKCS#11 security token or smartcard (e\&.g\&. a YubiKey)\&. Expects a PKCS#11 smart card URI referring to the token\&. Alternatively the special value
"auto"
may be specified, in order to automatically determine the URI of a currently plugged in security token (of which there must be exactly one)\&. The special value
"list"
may be used to enumerate all suitable PKCS#11 tokens currently plugged in\&. The security token must contain an RSA key pair which is used to encrypt the randomly generated key that is used to unlock the LUKS2 volume\&. The encrypted key is then stored in the LUKS2 JSON token header area\&.
.sp
In order to unlock a LUKS2 volume with an enrolled PKCS#11 security token, specify the
\fBpkcs11\-uri=\fR
option in the respective
/etc/crypttab
line:
.sp
.if n \{\
.RS 4
.\}
.nf
myvolume /dev/sda1 \- pkcs11\-uri=auto
.fi
.if n \{\
.RE
.\}
.sp
See
\fBcrypttab\fR(5)
for a more comprehensive example of a
\fBsystemd\-cryptenroll\fR
invocation and its matching
/etc/crypttab
line\&.
.RE
.PP
\fB\-\-fido2\-device=\fR\fIPATH\fR
.RS 4
Enroll a FIDO2 security token that implements the
"hmac\-secret"
extension (e\&.g\&. a YubiKey)\&. Expects a
hidraw
device referring to the FIDO2 device (e\&.g\&.
/dev/hidraw1)\&. Alternatively the special value
"auto"
may be specified, in order to automatically determine the device node of a currently plugged in security token (of which there must be exactly one)\&. The special value
"list"
may be used to enumerate all suitable FIDO2 tokens currently plugged in\&. Note that many hardware security tokens that implement FIDO2 also implement the older PKCS#11 standard\&. Typically FIDO2 is preferable, given it\*(Aqs simpler to use and more modern\&.
.sp
In order to unlock a LUKS2 volume with an enrolled FIDO2 security token, specify the
\fBfido2\-device=\fR
option in the respective
/etc/crypttab
line:
.sp
.if n \{\
.RS 4
.\}
.nf
myvolume /dev/sda1 \- fido2\-device=auto
.fi
.if n \{\
.RE
.\}
.sp
See
\fBcrypttab\fR(5)
for a more comprehensive example of a
\fBsystemd\-cryptenroll\fR
invocation and its matching
/etc/crypttab
line\&.
.RE
.PP
\fB\-\-fido2\-with\-client\-pin=\fR\fIBOOL\fR
.RS 4
When enrolling a FIDO2 security token, controls whether to require the user to enter a PIN when unlocking the volume (the FIDO2
"clientPin"
feature)\&. Defaults to
"yes"\&. (Note: this setting is without effect if the security token does not support the
"clientPin"
feature at all, or does not allow enabling or disabling it\&.)
.RE
.PP
\fB\-\-fido2\-with\-user\-presence=\fR\fIBOOL\fR
.RS 4
When enrolling a FIDO2 security token, controls whether to require the user to verify presence (tap the token, the FIDO2
"up"
feature) when unlocking the volume\&. Defaults to
"yes"\&. (Note: this setting is without effect if the security token does not support the
"up"
feature at all, or does not allow enabling or disabling it\&.)
.RE
.PP
\fB\-\-fido2\-with\-user\-verification=\fR\fIBOOL\fR
.RS 4
When enrolling a FIDO2 security token, controls whether to require user verification when unlocking the volume (the FIDO2
"uv"
feature)\&. Defaults to
"no"\&. (Note: this setting is without effect if the security token does not support the
"uv"
feature at all, or does not allow enabling or disabling it\&.)
.RE
.PP
\fB\-\-tpm2\-device=\fR\fIPATH\fR
.RS 4
Enroll a TPM2 security chip\&. Expects a device node path referring to the TPM2 chip (e\&.g\&.
/dev/tpmrm0)\&. Alternatively the special value
"auto"
may be specified, in order to automatically determine the device node of a currently discovered TPM2 device (of which there must be exactly one)\&. The special value
"list"
may be used to enumerate all suitable TPM2 devices currently discovered\&.
.sp
In order to unlock a LUKS2 volume with an enrolled TPM2 security chip, specify the
\fBtpm2\-device=\fR
option in the respective
/etc/crypttab
line:
.sp
.if n \{\
.RS 4
.\}
.nf
myvolume /dev/sda1 \- tpm2\-device=auto
.fi
.if n \{\
.RE
.\}
.sp
See
\fBcrypttab\fR(5)
for a more comprehensive example of a
\fBsystemd\-cryptenroll\fR
invocation and its matching
/etc/crypttab
line\&.
.sp
Use
\fB\-\-tpm2\-pcrs=\fR
(see below) to configure which TPM2 PCR indexes to bind the enrollment to\&.
.RE
.PP
\fB\-\-tpm2\-pcrs=\fR [PCR...]
.RS 4
Configures the TPM2 PCRs (Platform Configuration Registers) to bind the enrollment requested via
\fB\-\-tpm2\-device=\fR
to\&. Takes a
"+"
separated list of numeric PCR indexes in the range 0\&...23\&. If not used, defaults to PCR 7 only\&. If an empty string is specified, binds the enrollment to no PCRs at all\&. PCRs allow binding the enrollment to specific software versions and system state, so that the enrolled unlocking key is only accessible (may be "unsealed") if specific trusted software and/or configuration is used\&.
.sp
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.B Table\ \&1.\ \&Well\-known PCR Definitions
.TS
allbox tab(:);
lB lB.
T{
PCR
T}:T{
Explanation
T}
.T&
l l
l l
l l
l l
l l
l l
l l
l l
l l.
T{
0
T}:T{
Core system firmware executable code; changes on firmware updates
T}
T{
1
T}:T{
Core system firmware data/host platform configuration; typically contains serial and model numbers, changes on basic hardware/CPU/RAM replacements
T}
T{
2
T}:T{
Extended or pluggable executable code; includes option ROMs on pluggable hardware
T}
T{
3
T}:T{
Extended or pluggable firmware data; includes information about pluggable hardware
T}
T{
4
T}:T{
Boot loader; changes on boot loader updates
T}
T{
5
T}:T{
GPT/Partition table; changes when the partitions are added, modified or removed
T}
T{
6
T}:T{
Power state events; changes on system suspend/sleep
T}
T{
7
T}:T{
Secure boot state; changes when UEFI SecureBoot mode is enabled/disabled
T}
T{
8
T}:T{
\fBsd-boot\fR(7) measures the kernel command line in this PCR\&.
T}
.TE
.sp 1
.RE
.PP
\fB\-\-wipe\-slot=\fR [SLOT...]
.RS 4
Wipes one or more LUKS2 key slots\&. Takes a comma separated list of numeric slot indexes, or the special strings
"all"
(for wiping all key slots),
"empty"
(for wiping all key slots that are unlocked by an empty passphrase),
"password"
(for wiping all key slots that are unlocked by a traditional passphrase),
"recovery"
(for wiping all key slots that are unlocked by a recovery key),
"pkcs11"
(for wiping all key slots that are unlocked by a PKCS#11 token),
"fido2"
(for wiping all key slots that are unlocked by a FIDO2 token),
"tpm2"
(for wiping all key slots that are unlocked by a TPM2 chip), or any combination of these strings or numeric indexes, in which case all slots matching either are wiped\&. As safety precaution an operation that wipes all slots without exception (so that the volume cannot be unlocked at all anymore, unless the volume key is known) is refused\&.
.sp
This switch may be used alone, in which case only the requested wipe operation is executed\&. It may also be used in combination with any of the enrollment options listed above, in which case the enrollment is completed first, and only when successful the wipe operation executed \(em and the newly added slot is always excluded from the wiping\&. Combining enrollment and slot wiping may thus be used to update existing enrollments:
.sp
.if n \{\
.RS 4
.\}
.nf
systemd\-cryptenroll /dev/sda1 \-\-wipe\-slot=tpm2 \-\-tpm2\-device=auto
.fi
.if n \{\
.RE
.\}
.sp
The above command will enroll the TPM2 chip, and then wipe all previously created TPM2 enrollments on the LUKS2 volume, leaving only the newly created one\&. Combining wiping and enrollment may also be used to replace enrollments of different types, for example for changing from a PKCS#11 enrollment to a FIDO2 one:
.sp
.if n \{\
.RS 4
.\}
.nf
systemd\-cryptenroll /dev/sda1 \-\-wipe\-slot=pkcs11 \-\-fido2\-device=auto
.fi
.if n \{\
.RE
.\}
.sp
Or for replacing an enrolled empty password by TPM2:
.sp
.if n \{\
.RS 4
.\}
.nf
systemd\-cryptenroll /dev/sda1 \-\-wipe\-slot=empty \-\-tpm2\-device=auto
.fi
.if n \{\
.RE
.\}
.RE
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print a short help text and exit\&.
.RE
.PP
\fB\-\-version\fR
.RS 4
Print a short version string and exit\&.
.RE
.SH "EXIT STATUS"
.PP
On success, 0 is returned, a non\-zero failure code otherwise\&.
.SH "SEE ALSO"
.PP
\fBsystemd\fR(1),
\fBsystemd-cryptsetup@.service\fR(8),
\fBcrypttab\fR(5),
\fBcryptsetup\fR(8)
